package com.hjm.friend.service.file.impl;



import com.hjm.common.core.enums.ResultCode;
import com.hjm.file.domain.OSSResult;
import com.hjm.file.service.OSSService;
import com.hjm.friend.service.file.FileService;
import com.hjm.security.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;


@Service
public class FileServiceImpl implements FileService {


    @Autowired
    OSSService ossService;


    @Override
    public OSSResult upload(MultipartFile file) {
        try{
            return ossService.uploadFile(file);
        } catch (Exception e) {
            throw new ServiceException(ResultCode.FAILED_FILE_UPLOAD);
        }
    }
}
